package com.yc.bigdata.common.utils;

import java.io.*;
import java.util.Properties;

/**
 * <p></p>
 *
 * @author: YuanChilde
 * @date: 2020-02-15 14:43
 * @version: 1.0
 * Modification History:
 * Date    Author      Version     Description
 * -----------------------------------------------------------------
 * 2020-02-15 14:43    YuanChilde     1.0        新增
 */
public class PropertyUtil {
    private static String basePath = System.getProperty("user.dir");
    private static Properties properties;

    static {
        properties = new Properties();
        InputStream inputStream;
        try {
            inputStream = new FileInputStream(basePath + "/conf.properties");
            properties.load(inputStream);
        } catch (IOException e) {
            inputStream = PropertyUtil.class.getClassLoader().getResourceAsStream("conf.properties");
            try {
                properties.load(inputStream);
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    }

    public static String get(String key) {
        return properties.getProperty(key);
    }
}
